Skip to content

Cursor grabbing fixes - #385

Merged
tomaka merged 1 commit into
rust-windowing:masterfrom
lolzballs:master
Jan 26, 2018
Merged

tomaka merged 1 commit into
rust-windowing:masterfrom
lolzballs:master

Conversation

@lolzballs

Copy link
Copy Markdown
Contributor
  • Only update cursor_state when the grab is successful
  • Ungrab before grabbing to prevent passive grabs (ex. clicking) from causing AlreadyGrabbed

The ungrabbing issue can occur when grabbing the pointer through a mouse click (common in FPSes). The mouse click will cause X11 to grab the pointer, making the XGrabPointer request fail with AlreadyGrabbed. This issue can't be worked around in the client, because there is no exposed method for ungrabbing a passively grabbed cursor.

- Only update cursor_state when the grab is successful
- Ungrab before grabbing to prevent passive grabs (ex. clicking) from
causing AlreadyGrabbed
@francesca64
francesca64 self-requested a review January 26, 2018 19:23

@francesca64 francesca64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, and in testing this, the improvement is easy to see.

I wasn't sure how semantically correct it was to ungrab like this, but after doing some research, I'm not aware of any alternatives.

@tomaka

tomaka commented Jan 26, 2018

Copy link
Copy Markdown
Contributor

@francesca64 Thanks for looking at this!

@tomaka
tomaka merged commit 7d38ed2 into rust-windowing:master Jan 26, 2018
sodiumjoe pushed a commit to sodiumjoe/winit that referenced this pull request Mar 19, 2018
- Only update cursor_state when the grab is successful
- Ungrab before grabbing to prevent passive grabs (ex. clicking) from
causing AlreadyGrabbed
tmfink pushed a commit to tmfink/winit that referenced this pull request Jan 5, 2022
Start a new `web_canvas` crate, for usage in the browser as a `<canvas>` replacement
madsmtm pushed a commit to madsmtm/winit that referenced this pull request Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants